<template>
    <el-container class="home-container">
        <el-header>
            <div class="sysname">
                <span>宿舍管理系统</span>
            </div>
            <el-button type="info">退出</el-button>
        </el-header>
        <el-container>
            <el-aside :width="isCollapse ? '64px' : '200px'">
                <div class="toggle-button" @click="toggleClapse">||||</div>
                <el-menu
                        background-color="#333744"
                        text-color="#fff"
                        active-text-color="#ffd04b"
                        router
                        unique-opened
                        :collapse="isCollapse"
                        :collapse-transition="false"
                >
                    <el-menu-item :index="item.url + ''" v-for="item in menuList" :key="item.id">
                        <template slot="title">
                            <i :class="item.icon"></i>
                            <span class="menutext">{{item.name}}</span>
                        </template>
                    </el-menu-item>
                </el-menu>
            </el-aside>
            <el-main>
                <router-view />
            </el-main>
        </el-container>
    </el-container>
</template>

<script>
    export default {
        data() {
            return {
                menuList: [
                  {
                    id: 22,
                    name: "主页",
                    url: "/",
                    icon:"el-icon-menu",
                  },
                    {
                        id: 1,
                        name: "学生管理",
                        url: "/home/students",
                        icon:"el-icon-message"
                    },
                    {
                        id: 4,
                        name: "宿舍管理",
                        url: "/home/dorms",
                        icon:"el-icon-s-tools",
                        children: [{ id: 5, name: "部门列表", url: "/department" }]
                    },
                    {
                        id: 7,
                        name: "宿管管理",
                        url: "/home/dormadmin",
                        icon:"el-icon-picture",
                    },
                    {
                        id: 10,
                        name: "学生迁出",
                        url: "/home/dormchange",
                        icon:"el-icon-user-solid",
                        children: [{ id: 11, name: "角色列表", url: "/sysrole" }]
                    },
                    {
                        id: 20,
                        name: "维修管理",
                        url: "/home/maintenance",
                        icon:"el-icon-star-on",
                    },
                  {
                    id: 21,
                    name: "公告管理",
                    url: "/home/announce",
                    icon:"el-icon-warning",
                  },

                ],
                isCollapse: false,

            };
        },
        methods: {
            toggleClapse() {
                this.isCollapse = !this.isCollapse;
            },
            logout() {

            },

        },
        created() {

        }
    };
</script>
<style lang="less" scoped>

    .menutext{
      font-size: 18px;
    }
    .sysname{
      margin-left: 26px;
    }
    img {
        width: 30px;
        height: 30px;
    }
    .toggle-button {
        background-color: #373d48;
        font-size: 10px;
        text-align: center;
        color: #fff;
        letter-spacing: 0.2em;
        cursor: pointer;
    }

    .el-header {
        background-color: #373d41;
        display: flex;
        justify-content: space-between;
        padding-left: 0;
        align-items: center;
        color: #fff;
        font-size: 22px;
        > div {
            display: flex;
            align-items: center;
            span {
                margin-left: 14px;
            }
        }
    }
    .el-aside {
        background-color: #333744;
        .el-menu {
            border-right: 0;
        }
    }
    .el-main {
        background-color: #eaedf1;
    }
    .home-container {
        height:700px;
    }
</style>
